package org.mcjug.locationmailer.model.template;

import org.mcjug.locationmailer.R;

import android.location.Location;

public class GoogleMapsUrlTemplateItem extends AbstractTemplateItem implements TemplateItem {

    @Override
    public int getTemplateItemId() {
        return R.string.emailKeywordGoogleMapsUrl;
    }

    @Override
    public String getTemplateItemValue() {
        Location location = getStatusMessage().getLocation();
        String googleMapsUrl;
        if (location != null) {
            googleMapsUrl = "http://maps.google.com/maps?q=" + location.getLatitude() + "," + location.getLongitude();
        } else {
            googleMapsUrl = "Location is null, google maps url not available";
        }
        return googleMapsUrl;
    }

    @Override
    public int getTemplateFlag() {
        return TemplateItem.FLAG_LOCATION;
    }

}
